package com.hae.mail.user.micomailuserservice.controller;

import com.hae.mail.user.api.UserService;
import com.hae.mail.user.model.UserDao;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class UerServiceImpController implements UserService {

    @RequestMapping("/getUserByName")
    @Override
    public UserDao searchUser(@RequestParam("userName") String userName) {
        UserDao userDao = new UserDao();
        userDao.setPassword("123");
        userDao.setUserName("hae");
        return userDao;
    }

    /**
     * 模拟随机生成用户
     * @return
     */
    @RequestMapping("/randomUser")
    @Override
    public UserDao randomUser() {
        try {
            Thread.sleep(1500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new UserDao();
    }
}
